package com.qef.com.mmovie.utils;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.View;

/**
 * Created by feq on 2017/4/8.
 */

public class AnimatiorUtils {
    public static void setTextViewAlphAnimator(View view) {
        ObjectAnimator.ofFloat(view, "alpha", 0, 1).setDuration(2000).start();
    }

    public static void setZoom(View view, int x, int y) {
        AnimatorSet animatorSet = new AnimatorSet();

        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "scaleX", x, y);
        ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "scaleY", x, y);
        animatorSet.playTogether(animator, animator1);
        animatorSet.setStartDelay(500);
        animatorSet.setDuration(1000).start();
        animatorSet.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animator) {

            }

            @Override
            public void onAnimationEnd(Animator animator) {

            }

            @Override
            public void onAnimationCancel(Animator animator) {

            }

            @Override
            public void onAnimationRepeat(Animator animator) {

            }
        });
//        ObjectAnimator.ofFloat(view, "translationX", x * 50, y * 50).setDuration(1000).start();
    }
}
